package com.subaiwang.service.login;

import com.subaiwang.dao.login.LoginMapper;
import com.subaiwang.pojo.Login;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("loginService")
public class LoginServiceImpl implements LoginService {
    @Resource
    private LoginMapper loginMapper;

    @Override
    public List<Login> getLogin(String username) {
        return loginMapper.getLogin(username);
    }

    @Override
    public int loginCount(String grade) {
        return loginMapper.loginCount(grade);
    }

    @Override
    public Login getUserName(String username, String password){
        Login login=loginMapper.getUserName(username);
        if (login!=null){
            if (login.getPassword().equals(password)){
                return login;
            }
        }
        return null;

    }

    @Override
    public boolean updatePassword(int id,String password){
        boolean flag=false;
        int dengs=loginMapper.updatePassword(id,password);
        if(dengs>0){
            return true;
        }
        return flag;
    }

    @Override
    public boolean getloginByPass(Login login,String password){
        boolean flag=false;
        if(login.getPassword().equals(password)){
            return true;
        }

        return flag;
    }


}
